#!/bin/bash
read -p "请输入文件全名" filename
read -p "请输入数据" data
if [ -w $filename -a -n $data ]
then
  echo $data > $filename
  echo "文件输出成功"
else
  echo "文件写入失败"
    
fi